<template>
  <div class="app-container">
    <el-page-header @back="goBack" content="详情页面"></el-page-header>
    <div
      style="display: flex; justify-content: space-between; margin-top: 20px; margin-bottom: 20px;"
    >
      <div>
        <el-button size="mini" @click="getList"> 刷新数据 </el-button>
      </div>
      <div>
        <el-button size="mini" v-if="form.bizEnterCheck.checkClassify == '1'" type="primary" @click="addStatusData"> 添加项目 </el-button>
        <el-button size="mini" v-if="form.bizEnterCheck.checkClassify == '2'" type="primary" @click="addStatusData"> 添加分组 </el-button>
      </div>
    </div>
    <el-table :data="tableDataList" style="width: 100%" :key="ikey">
      <el-table-column type="index" label="序号" align="center" />
      <el-table-column prop="checkProjectIdsList" label="项目名称" width="180" align="center"> </el-table-column>
      <el-table-column label="计划检查时间" width="180" align="center">
        <template slot-scope="scope">
          {{scope.row.planStartTime}}至{{scope.row.planEndTime}}
        </template>
      </el-table-column>
      <el-table-column prop="bizEnterTask.finishTime" label="完成检查时间" align="center"> </el-table-column>
      <el-table-column label="任务状态" align="center">
        <template slot-scope="scope">
          <el-tag
            effect="dark"
            :color="
              scope.row.bizEnterTask.status == '1'
                ? rgb1
                : scope.row.bizEnterTask.status == '2'
                ? rgb2
                : scope.row.bizEnterTask.status == '3'
                ? rgb3
                : rgb4
            "
            style="border: 0"
          >
            <dict-tag
              :options="dict.type.check_status"
              :value="scope.row.bizEnterTask.status"
            />
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="groupLeaderList" label="检查组长" align="center"> </el-table-column>
      <el-table-column prop="groupMemberList" label="检查人数" align="center" width="100"> </el-table-column>
      <el-table-column prop="qualityNum" label="质量问题数" align="center" width="100">
        <!-- <template slot-scope="scope">
          <span v-if="scope.row.qualityNum > 0 ">
          {{scope.row.qualityNum}}
          </span>
        </template> -->
      </el-table-column>
      <el-table-column prop="qualityOverNum" label="质量问题数整改情况" align="center">
        <template slot-scope="scope">
          <span v-if=" scope.row.qualityNum > 0">
          {{scope.row.qualityOverNum}}/{{scope.row.qualityNum}}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="LookExamine(scope.row)">查看</el-button>
          <el-button type="text" @click="reviseExamine(scope.row)">修改任务分配</el-button>
          <el-button type="text" @click="delExamine(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>



    <!-- 添加或修改企业检查-项目对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form
        ref="rulesTable"
        :model="form"
        label-width="100px"
        style="margin-right: 100px"
      >
        <el-form-item
          label="分组名称"
          prop="groupName"
          :rules="{ required: true,message: '请输入分组名称',trigger: ['change', 'blur']}"
          v-if="form.bizEnterCheck.checkClassify == '2'"
        >
          <el-input
            v-model="form.groupName"
            placeholder="请输入分组名称"
          ></el-input>
        </el-form-item>
        <el-form-item label="检查项目" :rules="{ required: true,message: '请选择检查项目',trigger: ['change', 'blur']}">
          <el-input
            :disabled="disabled"
            v-model="tableDataText"
            @click.native.stop="inputClickdata('请选择检查项目')"
            placeholder="请选择检查项目"
          ></el-input>
        </el-form-item>
        <el-form-item label="计划检查时间">
          <el-date-picker
            v-model="form.dataTime"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>

        <el-form-item label="检查组长" prop="groupLeader">
          <el-input
            v-model="tablePeopleDataText"
            placeholder="请选择检查组长"
            @click.native.stop="inputClickdata('请选择检查组长')"
          ></el-input>
        </el-form-item>
        <el-form-item label="参检人员" prop="groupMember">
          <template slot-scope=""> </template>
          <el-input
            v-model="tableZyPeopleDataText"
            placeholder="请选择参检人员"
            @click.native.stop="inputClickdata('请选择参检人员')"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitVisible">保存</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
      <el-dialog
        width="70%"
        :title="innerTitle"
        :visible.sync="innerVisible"
        append-to-body
      >
        <div class="dialog-box" >
          <div style="height: 100%; width: 27%; border-right: 1px solid">
            <div
              style="
                width: 100%;
                background: rgb(239, 239, 239);
                height: 40px;
                line-height: 40px;
                padding-left: 10px;
                font-size: 15px;
              "
            >
              选择单位
            </div>
            <div>
              <el-tree
                :data="deptOptionsInner"
                :props="defaultProps"
                :expand-on-click-node="false"
                :filter-node-method="filterNode"
                ref="tree"
                node-key="id"
                default-expand-all
                highlight-current
                @node-click="handleNodeClick"
              />
            </div>
          </div>
          <div style="height: 100%; width: 50%; border-right: 1px solid">
            <div v-if="innerTitle == '请选择检查项目'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                选择单位
              </div>
              <el-table :data="tableData" style="width: 100%" height="457">
                <el-table-column prop="name" label="项目名称">
                </el-table-column>
                <el-table-column prop="deptName" label="所属单位">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      v-if="scope.row.status"
                      @click="statusData(scope.row)"
                      :key="ikey"
                    >
                      添加
                    </el-button>
                    <el-button type="text" v-else :key="ikey">
                      已添加
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerTitle == '请选择检查组长'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                部门用户
              </div>
              <el-table
                :data="tablePeopleData"
                style="width: 100%"
                height="457"
              >
                <el-table-column prop="nickName" label="姓名">
                </el-table-column>
                <el-table-column prop="phonenumber" label="手机号">
                </el-table-column>
                <el-table-column prop="phonenumber" label="手机号" v-if="false">
                </el-table-column>
                <el-table-column prop="dept.deptName" label="部门">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      v-if="scope.row.status"
                      @click="statusZzData(scope.row)"
                    >
                      添加
                    </el-button>
                    <el-button type="text" v-else> 已添加 </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerTitle == '请选择参检人员'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                部门用户
              </div>
              <el-table
                :data="tableZyPeopleData"
                style="width: 100%"
                height="457"
              >
                <el-table-column prop="nickName" label="姓名">
                </el-table-column>
                <el-table-column prop="phonenumber" label="手机号">
                </el-table-column>
                <el-table-column prop="phonenumber" label="手机号" v-if="false">
                </el-table-column>
                <el-table-column prop="dept.deptName" label="部门">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      v-if="scope.row.status"
                      @click="statusZyData(scope.row)"
                    >
                      添加
                    </el-button>
                    <el-button type="text" v-else> 已添加 </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div style="height: 100%; width: 23%">
            <div v-if="innerTitle == '请选择检查项目'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                已选择项目({{ innerTableData.length }})
                <el-button size="mini" @click="del" style="margin-left: 40%">
                  清 空
                </el-button>
              </div>
              <el-table :data="innerTableData" style="width: 100%">
                <el-table-column prop="name" label="项目名称" :key="ikey">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="statusDataUpdate(scope.row)"
                      :key="ikey"
                    >
                      删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerTitle == '请选择检查组长'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                已选择检查组长({{ innerZzTableData.length }})
                <el-button size="mini" @click="delZz" style="margin-left: 30%">
                  清 空
                </el-button>
              </div>
              <el-table :data="innerZzTableData" style="width: 100%">
                <el-table-column prop="nickName" label="姓名" :key="ikey">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="statusZzDataUpdate(scope.row)"
                      :key="ikey"
                    >
                      删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerTitle == '请选择参检人员'">
              <div
                style="
                  width: 100%;
                  background: rgb(239, 239, 239);
                  height: 40px;
                  line-height: 40px;
                  padding-left: 10px;
                  font-size: 15px;
                "
              >
                已选择参检人员({{ innerZyTableData.length }})
                <el-button size="mini" @click="delZy" style="margin-left: 30%">
                  清 空
                </el-button>
              </div>
              <el-table :data="innerZyTableData" style="width: 100%">
                <el-table-column prop="nickName" label="姓名" :key="ikey">
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="statusZyDataUpdate(scope.row)"
                      :key="ikey"
                    >
                      删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="saveInnerVisible">保存</el-button>
          <el-button @click="innerVisibleDel">取 消</el-button>
        </div>
      </el-dialog>
    </el-dialog>

    <el-dialog
        width="800px"
        title="任务详情"
        :visible.sync="opendata"
        append-to-body
      >
      <el-form
        ref="rulesTable"
        :model="textData"
        label-width="120px"
        style="margin-right: 100px"
      >
        <el-form-item
          label="分组名称"
          prop="groupName"
          v-if="$route.query.checkClassify == '2'"
        >
        {{textData.groupName}}
        </el-form-item>
        <el-form-item label="检查项目：">
          {{textData.checkProjectIdsList}}
        </el-form-item>
        <el-form-item label="计划检查时间：">
          {{textData.planStartTime}}至{{textData.planEndTime}}
        </el-form-item>

        <el-form-item label="检查组长：" prop="groupLeader">
         {{textData.groupLeaderList}}
        </el-form-item>
        <el-form-item label="参检人员：" prop="groupMember">
          {{textData.groupMemberList}}
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitVisible">保存</el-button>
        <el-button @click="opendata = false">取 消</el-button>
      </div>
      </el-dialog>
  </div>
</template>

<script>
import { mapState } from "vuex";
import {getDataList} from "@/api/biz/enter/enter";
import {
  getTree,
  getdeptTree,
  getTableData,
  getPeopleData,
  addExamine,
  getExamine,
  reviseExamine,
  delExamine,
} from "@/api/biz/enter/enterNext";
export default {
  dicts: ["check_status", "check_according"],
  data() {
    return {
      opendata:false,
      disabled:true,
      ikey: 0,
      rgb1: "rgb(147, 210, 243)",
      rgb2: "rgb(255, 191, 107)",
      rgb3: "rgb(162, 239, 77)",
      rgb4: "rgb(144, 147, 153)",
      tableDataList: [],
      // 弹出层标题
      title: "",
      innerTitle: "",
      // 是否显示弹出层
      open: false,
      innerVisible: false,
      // 表单参数
      form: {
        bizEnterCheck: {
          checkClassify: this.$route.query.checkClassify, //任务分配类型
          checkType: null, //检查类型
          checkName: null, //任务名称
          checkExplain: null, //检查说明
          checkBasis: null, //检查依据
          checkProjectIds: this.$store.state.app.selectData, //检查项目
        },
        bizEnterCheckProject: [],
        dataTime: null,
        bizEnterTask: [],
      },
      // 部门树选项
      deptOptions: [],
      typeNoData: {
        checkTypeNo: null,
      },
      deptOptionsInner: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      //项目
      tableData: [],
      tableDataText: null,
      innerTableData: [],
      innerTableDataList: [],
      //检查组长
      tablePeopleData: [],
      tablePeopleDataText: null,
      innerZzTableData: [],
      innerZzTableDataList: [],
      //检查组员
      tableZyPeopleData: [],
      tableZyPeopleDataText: null,
      innerZyTableData: [],
      innerZyTableDataList: [],
       // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        projectId: this.$store.state.app.selectData,
      },
      reviseId:null,
      textData:{
        groupName:null,
        checkProjectIdsList:null,
        planStartTime:null,
        planEndTime:null,
        groupLeaderList:null,
        groupMemberList:null,
      },
    };
  },
  watch: {
    $route: {
      handler(newVal, oldVal) {
        if (oldVal.name == "enterLook") {
          this.$store.state.tagsView.visitedViews =
            this.$store.state.tagsView.visitedViews.filter(
              (item) => item.name !== "enterLook"
            );
        }
      },
      deep: true,
    },
  },
  methods: {
    //返回
    goBack() {
      this.$router.push({ name: "Enter" });
      this.$store.state.tagsView.visitedViews =
        this.$store.state.tagsView.visitedViews.filter(
          (item) => item.name !== "enterLook"
        );
    },
    //添加项目
    addStatusData(){
      this.open = true;
      this.disabled=false
      this.reviseId == null
    },
    //输入框点击事件
    inputClickdata(data) {
      if (data == "请选择检查项目") {
        getTableData().then((data) => {
          this.tableData = data.rows;
          this.tableData.forEach((item) => {
            item.status = true;
          });
          if (this.innerTableData.length == 0) {
            this.innerTableData = this.innerTableDataList
          }
          for (let i = 0; i < this.tableData.length; i++) {
            for (let a = 0; a < this.innerTableData.length; a++) {
              if (this.tableData[i].id == this.innerTableData[a].id) {
                this.innerTableData[a].name = this.tableData[i].name
                this.tableData[i].status = false;
              }
            }
          }
          this.ikey += 1;
          this.innerTableDataList = [...this.innerTableData]
        });
      } else if (data == "请选择检查组长") {
        getPeopleData().then((data) => {
          this.tablePeopleData = data.rows;
          this.tablePeopleData.forEach((item) => {
            item.status = true;
          });
          if (this.innerZzTableData.length == 0) {
            this.innerZzTableData = this.innerZzTableDataList
          }
          for (let i = 0; i < this.tablePeopleData.length; i++) {
            for (let a = 0; a < this.innerZzTableData.length; a++) {
              if (
                this.tablePeopleData[i].userId ==
                this.innerZzTableData[a].userId
              ) {
                this.innerZzTableData[a] =this.tablePeopleData[i]
                this.tablePeopleData[i].status = false;
              }
            }
          }
          this.ikey += 1;
          this.innerZzTableDataList = [...this.innerZzTableData]
        });
      } else {
        getPeopleData().then((data) => {
          this.tableZyPeopleData = data.rows;
          this.tableZyPeopleData.forEach((item) => {
            item.status = true;
          });
          if (this.innerZyTableData.length == 0) {
            this.innerZyTableData = this.innerZyTableDataList
          }
          for (let i = 0; i < this.tableZyPeopleData.length; i++) {
            for (let a = 0; a < this.innerZyTableData.length; a++) {
              if (
                this.tableZyPeopleData[i].userId ==
                this.innerZyTableData[a].userId
              ) {
                this.innerZyTableData[a] = this.tableZyPeopleData[i]
                this.tableZyPeopleData[i].status = false;
              }
            }
          }
          this.ikey += 1;
          this.innerZyTableDataList = [...this.innerZyTableData]
        });
      }
      this.innerVisible = true;
      this.innerTitle = data;
      getdeptTree().then((dept) => {
        this.deptOptionsInner = dept.data;
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    // 节点单击事件
    handleNodeClick(data) {
      if (this.innerTitle == "请选择检查项目") {
        let signingDept = {
          signingDept: data.id,
        };
        getTableData(signingDept).then((data) => {
          this.tableData = data.rows;
          this.tableData.forEach((item) => {
            item.status = true;
          });
          for (let i = 0; i < this.tableData.length; i++) {
            for (let a = 0; a < this.innerTableData.length; a++) {
              if (this.tableData[i].id == this.innerTableData[a].id) {
                this.tableData[i].status = false;
              }
            }
          }
        });
      } else if (this.innerTitle == "请选择检查组长") {
        let deptId = {
          deptId: data.id,
        };
        getPeopleData(deptId).then((data) => {
          this.tablePeopleData = data.rows;
          this.tablePeopleData.forEach((item) => {
            item.status = true;
          });
          for (let i = 0; i < this.tablePeopleData.length; i++) {
            for (let a = 0; a < this.innerZzTableData.length; a++) {
              if (
                this.tablePeopleData[i].userId ==
                this.innerZzTableData[a].userId
              ) {
                this.tablePeopleData[i].status = false;
              }
            }
          }
        });
      }
    },
    //点击项目添加
    statusData(row) {
      this.tableData.forEach((item) => {
        if (item.id == row.id) {
          item.status = false;
          this.innerTableData.push(item);
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
    },
    //点击组长添加
    statusZzData(row) {
      this.tablePeopleData.forEach((item) => {
        if (item.userId == row.userId) {
          item.status = false;
          this.innerZzTableData.push(item); //组长
          this.innerZyTableData.push(item); //选中组长，将组长也同时放到组员里面
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
    },
    //点击组员添加
    statusZyData(row) {
      this.tableZyPeopleData.forEach((item) => {
        if (item.userId == row.userId) {
          item.status = false;
          this.innerZyTableData.push(item);
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
    },
    //点击项目删除
    statusDataUpdate(row) {
      this.tableData.forEach((item) => {
        if (item.id == row.id) {
          item.status = true;
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
      this.innerTableData = this.innerTableData.filter((item) => item != row);
    },
    //点击组长删除
    statusZzDataUpdate(row) {
      this.tablePeopleData.forEach((item) => {
        if (item.userId == row.userId) {
          item.status = true;
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
      this.innerZzTableData = this.innerZzTableData.filter(
        (item) => item != row
      );
      this.innerZyTableData.forEach((item) => {
        if (item.userId == row.userId) {
          this.innerZyTableData = this.innerZyTableData.filter(
            (item) => item != row
          );
        }
      });
    },
    //点击组员删除
    statusZyDataUpdate(row) {
      this.tableZyPeopleData.forEach((item) => {
        if (item.userId == row.userId) {
          item.status = true;
          this.ikey += 1;
          // this.$forceUpdate();
        }
      });
      this.innerZyTableData = this.innerZyTableData.filter(
        (item) => item != row
      );
    },
    //项目清空数据
    del() {
      this.innerTableData = [];
      this.tableData.forEach((item) => {
        item.status = true;
        this.ikey += 1;
        // this.$forceUpdate();
      });
    },
    //组长清空数据
    delZz() {
      this.innerZzTableData = [];
      this.tablePeopleData.forEach((item) => {
        item.status = true;
        this.ikey += 1;
        // this.$forceUpdate();
      });
    },
    //组员清空数据
    delZy() {
      this.innerZyTableData = [];
      this.tableZyPeopleData.forEach((item) => {
        item.status = true;
        this.ikey += 1;
        // this.$forceUpdate();
      });
    },
    //取消
    innerVisibleDel() {
      if (this.innerTitle == "请选择检查项目") {
        this.innerTableData = [];
      } else if (this.innerTitle == "请选择检查组长") {
        this.innerZzTableData = [];
      } else if (this.innerTitle == "请选择参检人员") {
        this.innerZyTableData = [];
      }
      this.innerVisible = false;
    },
    //弹框保存
    saveInnerVisible() {
      if (this.innerTitle == "请选择检查项目") {
        this.innerTableDataList = [...this.innerTableData]
        this.tableDataText = this.innerTableData.map((el) => el.name).join(", "); //项目
      }else if (this.innerTitle == "请选择检查组长") {
        this.innerZzTableDataList = this.innerZzTableData
        this.tablePeopleDataText = this.innerZzTableData
        .map((el) => el.nickName)
        .join(", "); //组长


        this.innerZyTableDataList = [...this.innerZzTableData]
        this.tableZyPeopleDataText = this.innerZzTableData
        .map((el) => el.nickName)
        .join(", "); //组员
      }else if (this.innerTitle == "请选择参检人员") {
        this.innerZyTableDataList = [...this.innerZyTableData]
        this.tableZyPeopleDataText = this.innerZyTableData
        .map((el) => el.nickName)
        .join(", "); //组员
      }
      this.innerVisible = false; //关闭弹框
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
    // 最外层 保存按钮   在这里对数据进行集中操作
    submitVisible() {
      if (this.innerTableData.length == 0||this.innerZzTableData== 0||this.innerZyTableData== 0) {
        this.innerTableData = this.innerTableData.map(item => item.id+'')
        this.innerZzTableData = this.innerZzTableData.map(item => item.userId+'')
        this.innerZyTableData = this.innerZyTableData.map(item => item.userId+'')
        let data = {
          planStartTime:this.form.dataTime[0],
          planEndTime:this.form.dataTime[1],
          bizEnterCheckId:this.$route.query.id,
          checkProjectIds:this.innerTableData.toString(),
          groupLeader: this.innerZzTableData.toString(),
          groupMember: this.innerZyTableData.toString(),
          groupName:this.form.groupName,
        }
        if (this.reviseId == null) {
          addExamine(data).then((data)=>{
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            this.getList()
          })
        }else{
          data.id = this.reviseId
          reviseExamine(data).then((data)=>{
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.reviseId == null
            this.getList()
          })
        }
      }else{
         this.$message({
          message: '请将数据填写完整',
          type: 'warning'
        });
      }
      // this.$refs.rulesTable.validate((valid) => {
      //   if (valid) {
        
          
      //   }
      // });
    },
    //修改任务分配
    reviseExamine(data){
      this.disabled=true
      getExamine(data.id).then(data=>{
        this.open = true;
        this.reviseId = data.data.id
        this.form.groupName = data.data.groupName
        this.form.dataTime = []
        this.form.dataTime.push(data.data.planStartTime)
        this.form.dataTime.push(data.data.planEndTime)
        this.tableDataText = data.data.checkProjectIdsList.join(", ")
        this.tablePeopleDataText = data.data.groupLeaderList.join(", ")
        this.tableZyPeopleDataText = data.data.groupMemberList.join(", ")
        this.innerTableData = data.data.checkProjectIds.split(',').map(id=>({id:parseInt(id)}))
        this.innerZzTableData = data.data.groupLeader.split(',').map(id=>({userId:parseInt(id)}))
        this.innerZyTableData = data.data.groupMember.split(',').map(id=>({userId:parseInt(id)}))
      })
      // reviseExamine(date)
    },
    //查询
    getList(){
      this.ikey = this.ikey++
      let data = {
      bizEnterCheckId:this.$route.query.id
    }
    getDataList(data).then((data)=>{
      this.tableDataList = data.rows
      this.tableDataList.forEach(item=>{
        item.checkProjectIdsList=item.checkProjectIdsList.join("、")
        item.groupLeaderList=item.groupLeaderList.join("、")
        item.groupMemberList=item.groupMemberList.length
      })
    })
    getTree(this.typeNoData).then((response) => {
        this.deptOptions = response.data;
      });
    },
    //查看
    LookExamine(data){
      getExamine(data.id).then(data=>{
        this.textData = data.data
        this.textData.checkProjectIdsList=this.textData.checkProjectIdsList.join("、")
        this.textData.groupLeaderList=this.textData.groupLeaderList.join("、")
        this.textData.groupMemberList=this.textData.groupMemberList.join("、")
        this.opendata = true
      })
    },
    //删除
    delExamine(data){
      delExamine(data.id).then(data=>{
        this.getList();
        this.$modal.msgSuccess("删除成功");
      })
    }
  },

  components: {},

  computed: { ...mapState(["app"]) ,
  watchClassify(){
      return this.form.bizEnterCheck.checkClassify
    }},

  created() {
    this.getList()
  },
};
</script>
<style scoped>
.dialog-box {
  height: 500px;
  border: 1px solid #000;
  display: flex;
}
</style>
